<?php
    /**
    * Email : mr.linhtx88@gmail.com   
    * Phone : +84919.021.508
    * 
    * History       :
    *   Date        : 17-Apr-2012
    *   Modified by : mr.linhtx88@gmail.com        
    *   Purpose     : create class bllVideo 
    */

    include_once("./Library/DataProvider/video/dalVideo.php");  

    class bllVideo {
         /*add select thread view
        *  add by ANHNT
        *  this function used to get thread in forum with number record need
        * 
        */
        public function getTopVideo($forumid,$limit){  
            $query = "
            SELECT
              p.pagetext,
              t.title,
              t.views,
              t.threadid
            FROM
              post p,
              thread t 
            WHERE p.threadid = t.threadid
              AND t.forumid = ".$forumid." 
            ORDER BY p.threadid DESC 
            LIMIT 0,".$limit.""; 
            // return
            return dalVideo::getTopVideo($query); 
        }
        //get top views video/
        public function getTopViewsVideo($forumid,$limit){  
            $query = "
            SELECT
              p.pagetext,
              t.title,
              t.views,
              t.threadid
            FROM
              post p,
              thread t 
            WHERE p.threadid = t.threadid
              AND t.forumid = ".$forumid." 
            ORDER BY t.`views` DESC  
            LIMIT 0,".$limit.""; 
            // return
            return dalVideo::getTopVideo($query); 
        }  
    }
?>
